﻿using System.Collections.Generic;
using System.Data;
namespace SLS.ExClassLib.HLASimulation.Federation
{
    public class Machine:ResourceBase
    {
        private readonly object _locker = new object();
        public string MachineKey;
        public string MachineID;
        public string SM;
        public string AgentID;
        private  string m_INSTANCEID;
        private string m_InstanceKey;
        public Machine(DataRow rowMachine)
            :base()
            {
            this.MachineKey = rowMachine["MachineKey"].ToString().Trim();
            this.MachineID = rowMachine["MachineID"].ToString().Trim();
            this.SM = rowMachine["SM"].ToString().Trim();
            this.AgentID = rowMachine["AgentID"].ToString().Trim();
            this.m_INSTANCEID = rowMachine["INSTANCEID"].ToString().Trim();
            this.m_InstanceKey = rowMachine["InstanceKey"].ToString().Trim();
            base.NewResource(MachineKey);
        }
        public List<Machine> NewMachineByTable(DataTable tableMachine) 
        {
            List<Machine> m_listMachine = new List<Machine>();
            Machine m_Machine;
            foreach (DataRow rowMachine in tableMachine.Rows)
            {
                m_Machine = new Machine(rowMachine);
                m_listMachine.Add(m_Machine);
            }
            return m_listMachine;
        }
        public Machine(Machine srcMachine)
            {
            this.MachineKey = srcMachine.MachineKey;
            this.MachineID = srcMachine.MachineID;
            this.SM = srcMachine.SM;
            this.AgentID = srcMachine.AgentID;
            this.m_INSTANCEID = srcMachine.m_INSTANCEID;
            this.m_InstanceKey = srcMachine.m_InstanceKey;
            base.NewResource(MachineKey);
        } 
    }
}
